package com.yxw.srpc.test.bootstrap;

import com.yxw.srpc.proxy.RpcProxy;
import com.yxw.srpc.test.service.HelloService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.awt.*;

/**
 * Created by hp on 2016/5/11.
 */
public class ClientBootStrap {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext cpx = new ClassPathXmlApplicationContext("spring/spring_client.xml");
        RpcProxy rpcProxy = (RpcProxy)cpx.getBean("rpcProxy");
        final HelloService helloService = rpcProxy.create(HelloService.class);
        long s = System.currentTimeMillis();
        System.out.println(Thread.currentThread().getName());
        for(int i=0; i<300; i++){
            new Thread("" + i){
                public void run(int i){
                    String result = helloService.hello("World"+i);
                    System.out.println(result);
                }
            }.start();
        }
        long e = System.currentTimeMillis();
        System.out.println(e-s);
    }
}
